<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:61:"C:\wamp200\www\xgwnew/application/index\view\topup\index.html";i:1537151583;s:61:"C:\wamp200\www\xgwnew/application/index\view\public\base.html";i:1547453452;s:60:"C:\wamp200\www\xgwnew/application/index\view\public\nav.html";i:1533868925;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title><?php echo $title; ?></title>
<link rel="stylesheet" href="__PUBLIC__/xsd/css/mui.min.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/xsd/css/icons-extra.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/xsd/css/app.css?v1111121" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/bootstrap/bootstrap.min.css"/>

</head>
<!--/head-->
<body>
	<script src="__PUBLIC__/js/jquery.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" charset="utf-8"></script>
    <script type="text/javascript" src="https://apis.map.qq.com/tools/geolocation/min?key=QQ6BZ-24HC6-ZAXSZ-MTZAU-5MU2J-HEFEH&referer=鲜果屋"></script>
<script>
//alert("cc");
		  var geolocation = new qq.maps.Geolocation();
     var options = {timeout: 9000};
        var positionNum = 0;
	geolocation.getLocation(showPosition, showErr, options);
	
	function showPosition(position) {
		
            positionNum ++;
            document.getElementById("demo").innerHTML += "序号：" + positionNum;
            document.getElementById("demo").appendChild(document.createElement('pre')).innerHTML = JSON.stringify(position, null, 4);
            document.getElementById("pos-area").scrollTop = document.getElementById("pos-area").scrollHeight;
        };
 
        function showErr() {
            positionNum ++;
            document.getElementById("demo").innerHTML += "序号：" + positionNum;
            document.getElementById("demo").appendChild(document.createElement('p')).innerHTML = "定位失败！";
            document.getElementById("pos-area").scrollTop = document.getElementById("pos-area").scrollHeight;
        };

	
</script>

	<!--/header-->

<style>
    .mui-row.mui-fullscreen>[class*="mui-col-"] {
        height: 100%;
    }

    .mui-col-xs-3,
    .mui-col-xs-9 {
        overflow-y: auto;
        height: 100%;
    }

    .mui-segmented-control .mui-control-item {
        line-height: 50px;
        width: 100%;
    }

    .mui-control-content {
        display: block;
    }

    .mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active {
        background-color: #fff;
    }
    .mui-toast-container {
        bottom: 50%;
        z-index: 999999999999999999;
    }
    .mui-btn-block{
      padding: 5px;
      border: 1px solid #ccc !important;
      margin: 5px;
      -webkit-appearance: none;
    }
    .active .mui-icon{
      display: block !important;
    }
    .paylist.open{
          overflow-y: scroll;
    }

    .info-box{
      background-color: #3190e8;
      padding: .4rem .4rem;
      color:#fff;
    }
    .info-box .headimg {
      padding: 0.5rem 0;
    }
    .info-box .headimg img{

      font-size: 1.6rem;
      line-height: 1.6rem;
      width: 1.6rem;
      border-radius: 50%;
      height: 1.6rem;
      background: #fff;
      display: inline-block;
      vertical-align: middle;

    }
    .balance{
          color: #f90;
    }
    .hongbao{
          color: #ff5f3e;
    }
    .score{
            color: #6ac20b;
    }
    .mui-row {
      background-color: #fff;
    }
    .mui-row .mui-col-xs-6{
      padding: .453333rem 0 .293333rem;
      font-size: .32rem;
      line-height: .32rem;
      border-right: 1px solid #ddd;
    }

    .mui-row .mui-col-xs-6 span{
       font-size: .693333rem;
       line-height: .693333rem;
       font-weight: 700;
    }
</style>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/xsd/css/checkout.css" />
<header class="mui-bar mui-bar-nav" >
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">充值页面</h1>
</header>
<div class="mui-content" style="    margin-bottom:60px;">
  <div class="info-box mui-text-center">
    <div class="headimg">
      <img src="<?php echo \think\Session::get('user.headimgurl'); ?>">
    </div>
    <h4>Hi.<?php echo \think\Session::get('user.nickname'); if(!(empty(\think\Session::get('user.name')) || (\think\Session::get('user.name') instanceof \think\Collection && \think\Session::get('user.name')->isEmpty()))): ?>(会员)<?php endif; ?></h4>
  </div>
  <div class="mui-row mui-text-center">
    <div class="mui-col-xs-6">
       <p class="balance"> <span><?php echo \think\Session::get('user.balance'); ?></span>元 </p>
       <p >我的余额</p>
    </div>
    <div class="mui-col-xs-6" onclick='window.location.href = "<?php echo url('index/coupon/integral'); ?>"'>
      <p class="score"> <span><?php echo \think\Session::get('user.integral'); ?></span>分 </p>
      <p >我的积分</p>
    </div>
  </div>
<br />
  <div class="mui-card" style="padding:10px;">
    <!-- <?php if(empty(\think\Session::get('user.name')) || (\think\Session::get('user.name') instanceof \think\Collection && \think\Session::get('user.name')->isEmpty())): ?>      <p class="text-center" style=" text-align: center;padding: 30px;">        注册后才能进行充值      </p>      <a  class="mui-btn mui-btn-success zc" href="<?php echo url('user/info'); ?>" style="width:100%;">注册会员</a>&nbsp;&nbsp;    <?php else: ?> -->
    <form class="mui-input-group" method="post"  action="<?php echo url('index/topup/add'); ?>">
    					<div class="mui-input-row">
    						<label>充值卡号</label>
                		<input type="text" name="card" placeholder="请输入充值卡号">
    					</div>
    					<!-- <div class="mui-input-row">
    						<label>绑定的手机号</label>
                <?php echo \think\Session::get('user.phone')?'<div style="line-height: 1.1;    float: left;padding: 11px 0;">'.\think\Session::get('user.phone').'</div>' : '<input type="number" name="phone" placeholder="请输入绑定的手机号">'; ?>

    					</div> -->


              <div>
                          <input type="hidden" name="offlinepay_status" value="<?php echo $xstatus; ?>" />
              						<button type="button" class="mui-btn mui-btn-primary sbt" onclick="return false;" style="width:100%;margin-top:20px;">确认</button>&nbsp;&nbsp;

              					</div>
    			</form>
    <!-- <?php endif; ?> -->


  </div>

<nav class="mui-bar mui-bar-tab">
      <a class="mui-tab-item2  <?php if($request->path() == '/'): ?> mui-active<?php endif; ?>" href="/" onclick='window.location.href = "/"'>
        <span class="mui-icon mui-icon-home"></span>
        <span class="mui-tab-label">首页</span>
      </a>
      <a class="mui-tab-item2 <?php if($request->path() == 'index/order/index'): ?> mui-active<?php endif; ?>" href="<?php echo url('index/order/index'); ?>" onclick='window.location.href = "<?php echo url('index/order/index'); ?>"'>
        <span class="mui-icon mui-icon mui-icon-list"></span>
        <span class="mui-tab-label">订单</span>
      </a>
      <a class="mui-tab-item2 <?php if($request->path() == 'index/user/index'): ?> mui-active<?php endif; ?>" href="<?php echo url('index/user/index'); ?>" onclick='window.location.href = "<?php echo url('index/user/index'); ?>"'>
        <span class="mui-icon mui-icon-contact"></span>
        <span class="mui-tab-label">我的</span>
      </a>
 </nav>
<style>
.mui-bar-tab .mui-tab-item2 {
    display: table-cell;
    overflow: hidden;
    width: 1%;
    height: 50px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #929292
}

.mui-bar-tab .mui-tab-item2.mui-active {
    color: #007aff
}

.mui-bar-tab .mui-tab-item2 .mui-icon {
    top: 3px;
    width: 24px;
    height: 24px;
    padding-top: 0;
    padding-bottom: 0
}

.mui-bar-tab .mui-tab-item2 .mui-icon~.mui-tab-label {
    font-size: 11px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis
}

.mui-bar-tab .mui-tab-item2 .mui-icon:active {
    background: 0 0
}
</style>

</div>

<script id="zt" type="text/html">
    {{each  as value i}}
      <div class="paylist-item " data-couponid='{{value.id}}' data-total="{{value.total}}" data-price="{{value.price}}"><span> 满{{value.total}}元减{{value.price}}  </span> <span class="mui-icon mui-icon-checkmarkempty" style="color:#007aff;border: 1px solid;display:none"></span></div>

    {{/each}}
</script>



<!--/#footer-->



<script src="__PUBLIC__/js/bootstrap.js"></script>
<script src="__PUBLIC__/js/jquery.nanoscroller.min.js"></script>
<script src="__PUBLIC__/xsd/js/mui.min.js"></script>
<script src="__PUBLIC__/xsd/js/flexible.js"></script>
<script src="__PUBLIC__/xsd/js/template.js"></script>


<script type="text/javascript">
  $(function(){
    $("input[name='total']").keyup(function(){
      var val = $(this).val()
      $('.price').text(val)
      $('[name="coupon_id"]').val(0)
      $('#paywaytext').text(' ')
    })




    $('#payment').on('tap', function(){
        $('.paylist').addClass('open');
        $('.paylist').next().addClass('open');
    })
    $('.mask').on('tap', function(){
      $(this).removeClass('open')
      $('.paylist').removeClass('open')
    })



    //确定付款
    $('.sbt').on('tap', function(){
      var card = $.trim($('[name="card"]').val())
      var phone = $.trim($('[name="phone"]').val())
      console.log($('[name="phone"]').length);
      if(!card){
        mui.toast('请输入充值卡号！')
        return;
      }
      // if($('[name="phone"]').length == 1){
      //   if (!phone) {
      //        mui.toast("请输入手机号码！");
      //        return;
      //    } else if (!/^0?1[3|4|5|8]\d{9}$/.test(phone)) {
      //        mui.toast("你输入的手机号码不正确！");
      //        return;
      //    }
      // }
      $.post("<?php echo url('index/topup/add'); ?>", {
          "card": card
      }, function(data) {
        mui.toast(data.msg)
        if(data.code == 1){
          setTimeout(function() {
              location.reload()
          }, 2000);
        }
        if(data.code == 3){
          $(".zc").show()
        }


      }, "json");
    })


  })
</script>

<?php if(!(empty(config('shop_hours')) || (config('shop_hours') instanceof \think\Collection && config('shop_hours')->isEmpty()))): ?>
<script>
  var time_range = function (beginTime, endTime) {
    var strb = beginTime.split (":");
    if (strb.length != 2) {
      return false;
    }

    var stre = endTime.split (":");
    if (stre.length != 2) {
      return false;
    }

    var b = new Date ();
    var e = new Date ();
    var n = new Date ();

    b.setHours (strb[0]);
    b.setMinutes (strb[1]);
    e.setHours (stre[0]);
    e.setMinutes (stre[1]);

    if (n.getTime () - b.getTime () > 0 && n.getTime () - e.getTime () < 0) {
      return true;
    } else {

      mui.alert("<?php echo config('shop_hours_message'); ?>", '公告');
      $('.mui-popup-buttons').html(' ')
      $('.mui-popup-inner').css('border-radius', '13px')
      return false;
    }
  }

  var shop_hours = "<?php echo config('shop_hours'); ?>";
  var hours_arr = shop_hours.split('-');
  time_range (hours_arr[0], hours_arr[1]);

</script>
<?php endif; if(config('is_rest') == '1'): ?>
<script>
mui.alert("<?php echo config('rest_message'); ?>", '公告');
$('.mui-popup-buttons').html(' ')
$('.mui-popup-inner').css('border-radius', '13px')
</script>
<?php endif; ?>



<script>
  $(function(){
    $('.subsc').click(function(){
      // $.get("<?php echo url('index/clearusersession'); ?>", function(data){
      //   if(data.code == 1){
      //     window.location.href = "http://mp.weixin.qq.com/s/-AzpDTU7eAD24-R5QUP0wg"
      //   }
      // })
      //cookie('goodsmodel_id', $model_id);
      <?php switch(cookie('goodsmodel_id')): case "1":case "2":case "21":case "22":case "3": ?>
            mui.alert("<img src=<?php echo get_cover(config('frankserviceimg'), 'path'); ?> style='width:100%;'>", '长按扫二维码');
        <?php break; endswitch; if(!(empty($contact_qc) || ($contact_qc instanceof \think\Collection && $contact_qc->isEmpty()))): ?>
            mui.alert('<img src="<?php echo $contact_qc; ?>" style="width:100%;">', '长按扫二维码');
      <?php endif; ?>
    })


    $('.endlimit').each(function(){
      var $this = $(this);
      var stime = $this.attr('data-endtime');
      var starttime = new Date(stime.replace(/-/g,"/"))
      setInterval(function () {
        var nowtime = new Date();
        var time = starttime - nowtime;
        if(time > 0){
          var day = parseInt(time / 1000 / 60 / 60 / 24);
          var hour = parseInt(time / 1000 / 60 / 60 % 24);
          var minute = parseInt(time / 1000 / 60 % 60);
          var seconds = parseInt(time / 1000 % 60);
          $this.html("距结束还有:<span style='color:red'>"+ day + "天" + hour + "小时" + minute + "分钟" + seconds + "秒</span>");
        }

      }, 1000);
    })

    $('.hidecartbtn').each(function(){
      var id = $(this).attr('data-id')
      $('.cartbtn'+id).hide();
    })


  })
</script>

 

 <!-- <?php if(empty(\think\Cookie::get('positioninit')) || (\think\Cookie::get('positioninit') instanceof \think\Collection && \think\Cookie::get('positioninit')->isEmpty())): ?>
 <script type="text/javascript" src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script>
 <script>
   $(function(){
    var geolocation = new qq.maps.Geolocation("QQ6BZ-24HC6-ZAXSZ-MTZAU-5MU2J-HEFEH", "鲜果屋");
     geolocation.getIpLocation(showPosition, showErr)

   })

   function showPosition(position) {
     console.log(1111);
     $.getJSON("<?php echo url('index/cart/changecookie'); ?>", {name: 'positioninit', 'val': position.lat+','+position.lng}, function(json, textStatus) {});
  };
   function showErr() {
     console.log('定位失败');
   };
 </script>
 <?php endif; ?> -->

</body>
</html>
